<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Props\HasTooltip;

/**
 * 文本省略 Ellipsis
 * @method static Ellipsis make(mixed $children = null) Ellipsis组件
 */
class Ellipsis extends Schema
{
    protected string $componentName = "NEllipsis";

    use HasTooltip;

    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * 展开的触发方式
     * @return $this
     */
    public function expandTrigger(): static
    {
        return $this->prop("expand-trigger","click");
    }

    /**
     * 最大行数
     * @param int|string $lineClamp
     * @return $this
     */
    public function lineClamp(int|string $lineClamp): static
    {
        return $this->prop("line-clamp",$lineClamp);
    }

    /**
     * Tooltip 的属性
     * @param mixed $tooltip
     * @return $this
     */
    public function slotTooltip(mixed $tooltip): static
    {
        return $this->slot("tooltip",$tooltip);
    }

}
